import { apiUrl } from '~/config';
import Request from '~/core/request';

export function createGroup (data) {
	return Request.post(`${apiUrl}/groups`, data);
}

// export function myGroups(Id) {
// 	return Request.get(`${apiUrl}/cooks/${Id}/groups`);
// }

// 我的群
export function myGroups(cookid, page, size) {
	return Request.get(`${apiUrl}/cooks/${cookid}/groups?page=${page}&size=${size}`);
}

// 我的群详情
export function myGroupsDetail(id) {
	return Request.get(`${apiUrl}/groups/${id}`);
}

// 群成员
export function groupMembers(groupid, page, size) {
	return Request.get(`${apiUrl}/groups/${groupid}/group-members?page=${page}&size=${size}`);
}

// 添加群成员
export function addGroupMembers(data) {
	return Request.put(`${apiUrl}/group-members`, data);
}

export function delGroup(groupid) {
	return Request.delete(`${apiUrl}/groups/${groupid}`);
}

export function delMember(memberId) {
	return Request.delete(`${apiUrl}/group-members/${memberId}`);
}

export function upImage(data) {
	return Request.post(`${apiUrl}/wechat/uploadImage`, data);
}
